<?php

/**
 * Inmobiliario filter form base class.
 *
 * @package    sf_sandbox
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseInmobiliarioFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'adrema'               => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'nro'                  => new sfWidgetFormFilterInput(),
      'mbk'                  => new sfWidgetFormFilterInput(),
      'piso'                 => new sfWidgetFormFilterInput(),
      'dpto'                 => new sfWidgetFormFilterInput(),
      'pavimentada'          => new sfWidgetFormChoice(array('choices' => array('' => '', 'SI' => 'SI', 'NO' => 'NO'))),
      'frente'               => new sfWidgetFormFilterInput(),
      'superficie'           => new sfWidgetFormFilterInput(),
      'superficie_edificada' => new sfWidgetFormFilterInput(),
      'valor_tierra'         => new sfWidgetFormFilterInput(),
      'valor_edificio'       => new sfWidgetFormFilterInput(),
      'contribuyente_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contribuyente'), 'add_empty' => true)),
      'calle_id'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Calle'), 'add_empty' => true)),
      'barrio_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Barrio'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'adrema'               => new sfValidatorPass(array('required' => false)),
      'nro'                  => new sfValidatorPass(array('required' => false)),
      'mbk'                  => new sfValidatorPass(array('required' => false)),
      'piso'                 => new sfValidatorPass(array('required' => false)),
      'dpto'                 => new sfValidatorPass(array('required' => false)),
      'pavimentada'          => new sfValidatorChoice(array('required' => false, 'choices' => array('SI' => 'SI', 'NO' => 'NO'))),
      'frente'               => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'superficie'           => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'superficie_edificada' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'valor_tierra'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'valor_edificio'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'contribuyente_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Contribuyente'), 'column' => 'id')),
      'calle_id'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Calle'), 'column' => 'id')),
      'barrio_id'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Barrio'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('inmobiliario_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Inmobiliario';
  }

  public function getFields()
  {
    return array(
      'id'                   => 'Number',
      'adrema'               => 'Text',
      'nro'                  => 'Text',
      'mbk'                  => 'Text',
      'piso'                 => 'Text',
      'dpto'                 => 'Text',
      'pavimentada'          => 'Enum',
      'frente'               => 'Number',
      'superficie'           => 'Number',
      'superficie_edificada' => 'Number',
      'valor_tierra'         => 'Number',
      'valor_edificio'       => 'Number',
      'contribuyente_id'     => 'ForeignKey',
      'calle_id'             => 'ForeignKey',
      'barrio_id'            => 'ForeignKey',
    );
  }
}
